<template>
	<div class="myask">
		<van-nav-bar :title="title" fixed left-arrow @click-left="back" />

		<div class="content">
			<div class="list" v-for="item in askList" :key="item.id" @click="detail(item)">
				<div class="title">
					<div class="left">标题：</div>
					<div class="right">
						{{item.title}}
					</div>
				</div>
				<div v-html="item.postcontent"></div>
				<p class="source">
					<span>{{item.comment}}人回复</span>
					<span>{{item.reading}}人浏览</span>
				</p>
				<p class="time">发布时间：{{item.publishtime_text}}</p>


			</div>


		</div>
	</div>
</template>

<script>
	export default {
		name: "myAsk",
		components: {

		},
		data() {
			return {
				title: this.$route.query.title,
				userInfo:{},
				page:1,
				limit:20,
				askList:[]

			}
		},
		mounted() {
			this.userInfo = JSON.parse(this.$getcookie("userInfo"))
			this.getList()
		},
		methods: {
			back() {
				this.$router.go(-1)
			},
			getList() {
				let askData = {
					user_id: this.userInfo.user_id,
					token: this.$getcookie("jy_token"),
					limit: this.limit,
					page: this.page
				}
				this.$api.my.myAskingList(askData).then(res => {
					// 执行某些操作
					if (res.code == 1) {
						this.askList = res.data.data
					}

				})
			},
			detail(item){
				this.$router.push({name:'askdetail',query:{id:item.id}})
			}
		}


	}
</script>

<style scoped lang="less">
	.myask {
		padding-top: 46px;

		.van-nav-bar {
			.van-icon {
				color: #000;
			}

			.van-nav-bar__text {
				color: #5C5C5C;
			}
		}

		.content {
			background: #fff;
			margin-top: 0.59rem;
			padding: 1.19rem 1.03rem;

			.list {
				margin-bottom: 1rem;
				border-bottom: 1px solid #eee;
			}

			.title {
				display: flex;
				align-items: flex-start;
				justify-content: flex-start;
				font-size: 0.88rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(0, 0, 0, 1);
				line-height: 1.25em;

				.left {
					white-space: nowrap;
				}
			}

			.time {
				font-size: 0.81rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(106, 106, 106, 1);

				margin-top: 1.09rem;
				margin-bottom: 1.69rem;
			}

			.source {
				padding-right: 3.47rem;
				display: flex;
				justify-content: space-between;
				margin-top: 2.72rem;

				span {
					font-size: 0.81rem;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(106, 106, 106, 1);

				}
			}


		}

	}
</style>
